package com.itheima.demo1_面向对象封装复习.p02类的封装原则;

public class Student {
    //成员变量
    String name;
    private int age;

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if (age > 0 && age <= 200) {
            this.age = age;
        } else {
            System.out.println("您提供的年龄不合法");
        }

    }
}
